package StudyCode.summary.mycollection;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ChecksIfAnArrayOfObjectArrayIsEmptyOrNull {
	public static boolean isEmpty(final Object[] objs,
	                              Boolean isContentsCheck) {
		if (objs == null || objs.length < 1) {
			return true;
		}
		if (isContentsCheck) {
			for (Object obj : objs) {
				if (isEmpty(obj)) {
					return true;
				}
			}
		}
		return false;
	}

	public static boolean isEmpty(final Object obj) {
		if (obj == null) {
			return true;
		}
		if (obj instanceof String) {
			return isEmptyStr((String) obj);
		}
		return false;
	}

	@Deprecated
	private static boolean isEmptyStr(final String str) {
		return str == null || str.length() < 1;
	}
}
